package com.lyf.viewapp.list.animators;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SwitchCompat;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;

import com.lyf.viewapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Recyclerview Item带有动画效果
 */
public class RecyclerviewAnimatorsActivity extends AppCompatActivity {

    @BindView(R.id.recyclerview_animators_btn_animator_sample)
    Button recyclerviewAnimatorsBtnAnimatorSample;
    @BindView(R.id.recyclerview_animators_btn_adapter_sample)
    Button recyclerviewAnimatorsBtnAdapterSample;
    @BindView(R.id.recyclerview_animators_grid)
    SwitchCompat recyclerviewAnimatorsGrid;

    private boolean enabledGrid = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recyclerview_animators);
        ButterKnife.bind(this);

        recyclerviewAnimatorsBtnAnimatorSample.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(RecyclerviewAnimatorsActivity.this, AnimatorSampleActivity.class);
                i.putExtra("GRID", enabledGrid);
                startActivity(i);
            }
        });

        recyclerviewAnimatorsBtnAdapterSample.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(RecyclerviewAnimatorsActivity.this, AdapterSampleActivity.class);
                i.putExtra("GRID", enabledGrid);
                startActivity(i);
            }
        });

        recyclerviewAnimatorsGrid.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                enabledGrid = isChecked;
            }
        });

    }

}
